<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>查询客户诉求信息</title>
<link rel="stylesheet" 
	href=${pageContext.servletContext.contextPath}/js/bootstrap.min.css>
	
<link rel="stylesheet" type="text/css" href=${pageContext.servletContext.contextPath}/themes/default/easyui.css>   
<link rel="stylesheet" type="text/css" href=${pageContext.servletContext.contextPath}/themes/icon.css> 
<link rel="stylesheet" type="text/css" href=${pageContext.servletContext.contextPath}/themes/bootstrap/easyui.css>  
<script type="text/javascript" src=${pageContext.servletContext.contextPath}/js/jquery.min.js></script>   
<script type="text/javascript" src=${pageContext.servletContext.contextPath}/js/jquery.easyui.min.js></script> 
<script type="text/javascript" src=${pageContext.servletContext.contextPath}/js/easyui-lang-zh_CN.js></script>
<script type="text/javascript"
	src=${pageContext.servletContext.contextPath}/js/bootstrap.min.js></script>
</head>
<script>
//根据菜名搜索审批信息
function doSearch(value,name){
	$.ajax({
		url : "${pageContext.servletContext.contextPath}/searchfoodM",
		dataType : "json",
		async : true,
		data : {
			"fname" : value,
		},
		type : "post",
		success : function(r) {
			$.each(r,function(i,n){
				$("#dg").datagrid("loadData",{ rows : n });			
			})
		}
		
	});
	$('#isn').textbox('clear');
}
$(function(){
	//所有诉求数据表格
	$('#dg').datagrid({   
	    url:'${pageContext.servletContext.contextPath}/queryRequests',   
	    columns:[[    
	        {field:'rid',title:'诉求id',width:100},    
	        {field:'oid',title:'菜单id号',width:100},    
	        {field:'fname',title:'菜品名',width:100},    
	        {field:'rcontent',title:'诉求内容',width:100},    
	        {field:'rcount',title:'诉求数量',width:100},
	        {field:'rstate',title:'审批状态',width:100},    
	        {field:'uname',title:'审批人',width:100},
	        {field:'rtime',title:'审批时间',width:180},    
	    ]],
	 
	    striped:true,
	    pagination:true,
	    pageSize:5,
		pageList:[5,10,15,20],
	}); 
	
	//选择搜索类型
	$('#cc').combobox({
		panelHeight:100,
		value:"请选择...",
		onSelect: function(param){
			if(param.value=="sdate"){
				//alert(123)
				$("#sd").attr('style','display:solid');
				$("#sn").attr('style','display:none');
			}else if(param.value=="sfname"){
				$("#sd").attr('style','display:none');
				$("#sn").attr('style','display:solid');
			}else if(param.value=="sall"){
				$('#dg').datagrid('reload'); 
			}
		}
	});
	//根据日期查询审批信息
	$('#dd').datebox({
	    onSelect: function(date){
	        $.ajax({
	    		url : "${pageContext.servletContext.contextPath}/searchCheckByDateM",
	    		dataType : "json",
	    		async : true,
	    		data : {
	    			"dyear" : date.getFullYear(),
	    			"dmonth" : date.getMonth()+1,
	    			"dday" : date.getDate(),
	    		},
	    		type : "post",
	    		success : function(r) {
	    			$.each(r,function(i,n){
	    				$("#dg").datagrid("loadData",{ rows : n });			
	    			})
	    		}
	    		
	    	});
	        //$('#dd').textbox('clear');
	    }
	});


})

</script>
<body>
<span><h5 style="font-size: x-small;color: blue">按条件查找审批信息</h5></span>
<span>
<select class="easyui-combobox" id="cc" style="width:100px;">
    <option value="sall">全部</option>
	<option value="sfname">按名称查询</option>
	<option value="sdate">按日期查询</option>
</select>
</span>	
<span id="sd" style="display:none;" >
<input id="dd" class="easyui-datebox" data-options="prompt:'请选择日期...'" name='sdate' style="width:200px">
</span>
<span id="sn">
<input id="isn" class="easyui-searchbox" data-options="searcher:doSearch,prompt:'请输入菜品名...'" style="width:200px"></input>
</span>

<table id="dg"></table>
 
</body>
</html>